window.ddz = {};
window.UserData = {};
UserData = require("UserData");
ddz.SmiliesPath_mp3 = {
    man_ASheet_0:"resources/sound/man_ASheet_0.mp3",
    man_ASheet_1:"resources/sound/man_ASheet_1.mp3"
};
ddz.onLoadingData = {
    onMyWork:function(){
        wx.cloud.callFunction({
            name: 'myWork',
            data:{
                WorkopenId:UserData.UserInfo.openId,
            },
            complete(res){
                UserData.MyWork = res.result.data;
            }
        });
    },
    onMyAnswer:function(){
        wx.cloud.callFunction({
            name: 'myAnswer',
            data:{
                commentatorId:UserData.UserInfo.openId
            },
            complete(res){
                UserData.MyAnswer = res.result.data;
            }
        });
    }
},
ddz.AudioHelper = { // 音乐方法
    getMusicPlayManager: function() {
        return this.stopMusic(), this.musicPlayManager = wx.createInnerAudioContext(), this.musicPlayManager.obeyMuteSwitch = !0, 
        this.musicPlayManager;
    },
    playMusic: function(e, t, i) {
        this.stopMusic();
        var self = this;
        cc.loader.load(cc.url.raw(e), function(err, clip){
            self.current = cc.audioEngine.play(clip, t, i);
        });
    },
    rePlayMusic: function() {
        this.musicPlayManager && this.musicPlayManager.loop && this.musicPlayManager.play();
    },
    stopMusic: function() {
        cc.audioEngine.stop(this.current);
        this.current = null;
    },
    playEffect: function(e, t) { // 调用音乐
        cc.loader.load(cc.url.raw(e), function(err, clip){
            cc.audioEngine.play(clip, t, 0.7);
        });
    }
};
ddz.onScreenshotsSharing = function(){  // 分享
    var Mtop = UserData.Height ? UserData.Height : 1050;
    var Mleft =  UserData.Width ? UserData.Width: 720;
    cc.game.canvas.toTempFilePath({
        x: 0,
        y: 0,
        width: Mleft,
        height: Mtop,
        destWidth: 400,
        destHeight: 300,
        success: (res) => {
          wx.shareAppMessage({
            title:"你能猜对吗？",
            imageUrl: res.tempFilePath
          })
        }
    })
};